package com.ck.controller;

import com.ck.entity.UserEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ck
 * @date 2020-5-26 16:47:47
 */

@Api(tags = "测试控制类")
@RestController
public class HelloSwaggerController {


    @ApiOperation(value = "hello方法体", notes = "测试swagger")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", name = "userName", value = "姓名", required = true, dataType = "String")})
    @GetMapping("hello/{userName}")
    public String hello(@PathVariable String userName){
        String str = "hello " + userName;
        return str;
    }
    @ApiOperation(value = "保存用户", notes = "新增用户")
    @PostMapping("insertUser")
    public Object insertUser(@RequestBody UserEntity userEntity){
        List<UserEntity> list = new ArrayList<>();
        list.add(userEntity);
        return list;
    }
}
